//package com.yuan.spring.messagequeue.redisqueue;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.listener.PatternTopic;
//import org.springframework.data.redis.listener.RedisMessageListenerContainer;
//import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
//
///**
// * Created by 袁恩光 on 2017/12/7.
// */
//@Configuration
//public class RedisQueueConfig {``
//
//
//    @Bean
//    MessageListenerAdapter listen1(RedisReceiver redisReceiver) {
//        return new MessageListenerAdapter(redisReceiver, "receiveMessage");
//    }
//
//    @Bean
//    MessageListenerAdapter listen2(RedisReceiver redisReceiver) {
//        return new MessageListenerAdapter(redisReceiver, "receiveMessage2");
//    }
//
//
//    /**
//     * 如果chat 相同则多个消费者
//     *  chat* 正则匹配
//     */
//    @Bean
//    RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,
//                                            MessageListenerAdapter[] listenerAdapter) {
//        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
//        container.setConnectionFactory(connectionFactory);
//        container.addMessageListener(listenerAdapter[0], new PatternTopic("chat"));
//        container.addMessageListener(listenerAdapter[1], new PatternTopic("chat*"));
//        return container;
//    }
//
//}
